﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using QuanLyBanHang.DataConnection;
using System.Windows.Forms;

namespace QuanLyBanHang.QuerySQL
{
    class ClassLogin
    {
        Connect conn = new Connect();

        public DataTable ShowTK(String id, String pass)
        {
            DataTable tb = new DataTable(); ;
            try
            {
                string sql = "select *from NGUOIDUNG where ID = '"+id+"' and PASS = '"+pass+"'";
                tb = conn.getTable(sql);
            }
            catch (Exception e)
            {
                MessageBox.Show("Lỗi: " + e.Message);
            }
            return tb;
        }
        public void DMK(string tk, string pass)
        {
            try
            {
                string sql = "update NGUOIDUNG set PASS = '"+pass+"' where ID = '" + tk + "' ";
                conn.ExcuteQuerySql(sql);
                MessageBox.Show("Mật khẩu đã được thay đổi !");
            }
            catch (Exception e)
            {
                MessageBox.Show("Lỗi: " + e.Message);
            }
        }
    }
}
